﻿@{
    Layout = null;
     Sysconfig config = ViewData["config"] as Sysconfig;
     List<cart_items> goodsList = ViewBag.goodsList as List<cart_items>;
     cart_total goodsTotal = ViewBag.goodsTotal as cart_total;
}
<!DOCTYPE html>
<!--HTML5 doctype-->
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <title>购物车</title>
    <link rel="stylesheet" type="text/css" href="/mobile/css/style.css" />
    <script type="text/javascript" charset="utf-8" src="/mobile/js/zepto.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="/mobile/js/weui.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="/mobile/js/cart.js"></script>
    <script type="text/javascript">
        $(function () {
            $(".weui-tabbar a").eq(2).addClass("weui-bar__item_on"); //选中Tab
        });
    </script>
</head>

<body ontouchstart>
    <div class="page">
        <!--页面头部-->
        <div class="header">
            <a class="back" href="javascript:history.back();">
                <i class="iconfont icon-arrow-left"></i>
            </a>
            <h3>购物车</h3>
            <div class="right">
                <a class="weui-cell_access weui-cell_link" asp-controller="Index" asp-action="Index">
                    <i class="iconfont icon-home"></i>
                </a>
            </div>
        </div>
        <!--/页面头部-->
        <!--页面内容-->
        <div class="page__bd">

            @if (goodsList.Count > 0)
            {
                <!--商品清单-->
                <input id="jsondata" name="jsondata" type="hidden" />
                <div class="weui-panel weui-panel_access" style="margin-top:10px;">
                    <div class="weui-panel__hd">商品列表</div>
                    <div class="weui-panel__bd">
                        <div class="cart-list">
                            <ul>
                                @foreach(cart_items modelt in goodsList)
                                {
                                <li>
                                    <input name="hideChannelId" type="hidden" value="@modelt.channel_id" />
                                    <input name="hideArticleId" type="hidden" value="@modelt.article_id" />
                                    <input name="hideGoodsId" type="hidden" value="@modelt.goods_id" />
                                    <input name="hideStockQuantity" type="hidden" value="@modelt.stock_quantity" />
                                    <input name="hideGoodsPrice" type="hidden" value="@modelt.user_price" />
                                    <input name="hidePoint" type="hidden" value="@modelt.point" />
                                    <label class="select">
                                        <input type="checkbox" name="checkall" class="checkall" onclick="selectCart();" />
                                    </label>
                                    <a asp-controller="Goods" asp-action="Show" asp-route-id="@modelt.article_id" class="img-box">
                                        <img src="@modelt.img_url" />
                                    </a>
                                    <h2>@modelt.title</h2>
                                    <p class="stxt">@modelt.spec_text</p>
                                    <div class="note">
                                        <div class="btn-list">
                                            <a href="javascript:;" onclick="updateCart(this, '', -1);">-</a>
                                            <input name="goodsQuantity" type="text" value="@modelt.quantity" onblur="updateCart(this, '');" onkeydown="return checkNumber(event);" />
                                            <a href="javascript:;" onclick="updateCart(this, '', 1);">+</a>
                                            <a class="del" href="javascript:;" onclick="deleteCart('', this);">删除</a>
                                        </div>
                                        <i class="price">¥@modelt.user_price</i>
                                    </div>
                                </li>
                                }
                            </ul>
                        </div>

                        @if(goodsList.Count>0)
                        {
                        <div class="cart-foot">
                            <div>
                                <a class="all" href="javascript:;" onclick="selectCart(this);">
                                    <i class="iconfont icon-all"></i>
                                    <span>全选</span>
                                </a>
                                <a class="btn" href="javascript:;" onclick="formSubmit(this, '', 'shopping');">
                                    去结算(<b id="totalQuantity">0</b>)
                                </a>
                                <div class="total">
                                    <p>共计：￥<b id="totalAmount">0</b>元</p>
                                </div>
                            </div>
                        </div>
                        }
                    </div>
                </div>
                <!--/商品清单-->
            }

            @if (goodsList.Count == 0)
            {
                <!--购物车为空-->
                <div class="weui-msg msg-box">
                    <div class="weui-msg__icon-area">
                        <i class="weui-icon-info weui-icon_msg"></i>
                    </div>
                    <div class="weui-msg__text-area">
                        <h2 class="weui-msg__title">暂无商品</h2>
                        <p class="weui-msg__desc">
                            购物车暂无任何商品，马上去选一件吧！
                        </p>
                    </div>
                    <div class="weui-msg__opr-area">
                        <p class="weui-btn-area">
                            <a class="weui-btn weui-btn_primary" href="javascript:history.back();">返回首页</a>
                        </p>
                    </div>

                </div>
                <!--/购物车为空-->
            }

            <!--版权信息-->
            @await Html.PartialAsync("~/Areas/Web/Views/Shared/_Copyright.cshtml")
            <!--/版权信息-->
            <!--底部导航-->
            @await Html.PartialAsync("~/Areas/Web/Views/Shared/_Footer.cshtml")
            <!--/底部导航-->

        </div>
        <!--/页面内容-->

    </div>
</body>
</html>
